------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\africancabinets_africa.log
  log type:  text
 opened on:  30 Mar 2017, 12:51:53

. set more off

. #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      africancabinets_africa.do                       *;
. *       Date:           September 9, 2016                               *;
. *       Author:         Molly Ariotti and Sona Golder                   *;
. *       Purpose:        Replicate results for CPS African portfolio     *;
. *                       allocation paper, using Africa data 1990-2014.  *;
. *           Input File:     Africa.dta                                      *;
. *       Output File:    africancabinets_africa.log                      *;
. *       Data Output:    none                                            *;
.              *       Previous file:  none                                            *;
. *       Machine:        laptop                                                          *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Open and summarize dataset.                                     *;
. *     ****************************************************************  *;
. use "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa.dta";

.  sum;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
 countryname |          0
 countrycode |         84    5.559524    2.552349          1          9
 cabinetcode |         84    13.89286    8.034591          1         28
     cowcode |         84    517.8452    69.14373        403        590
        year |         84    2002.357    6.825965       1990       2014
-------------+---------------------------------------------------------
presidential |         84    .3690476    .4854451          0          1
   formateur |         84    .3095238    .4650739          0          1
  portfolios |         84     7.02381    6.860005          1         26
governmen~os |         84    21.08333    6.637259          9         35
 party_seats |         84    39.91667    56.69368          1        279
-------------+---------------------------------------------------------
governmen~ts |         84    115.0952    86.61028         39        377
      region |         84           1           0          1          1
portfolios~e |         84    .3333333     .282168   .0344828   .9545454
   seatshare |         84    .3333333    .2628826   .0034843    .990099
       party |         84    25.91667    13.80083          1         48
-------------+---------------------------------------------------------
        code |         84    105573.4    2560.162     101001     109028

. desc;

Contains data from \Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa.dta
  obs:            84                          
 vars:            16                          30 Mar 2017 12:13
 size:         4,368                          
------------------------------------------------------------------------------------------------------------------
              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------------------------------------------
countryname     str21   %21s                  country name
countrycode     byte    %8.0g                 country code
cabinetcode     byte    %8.0g                 cabinet code
cowcode         int     %8.0g                 cow code
year            int     %8.0g                 year in which government begins
presidential    byte    %8.0g                 1 = presidential, 0 = parliamentary
formateur       byte    %8.0g                 1 = formateur, 0 = otherwise
portfolios      byte    %8.0g                 number of portfolios per party
government_po~s byte    %8.0g                 number of portfolios in the government
party_seats     int     %8.0g                 number of legislative seats per party
government_se~s int     %8.0g                 number of seats controlled by government
region          byte    %8.0g                 1=Africa, 2=Western Europe, 3=Latin America
portfolioshare  float   %9.0g                 party share of govt portfolios
seatshare       float   %9.0g                 party share of leg seats controlled by govt
party           long    %9.0g      party      party number or acronym
code            float   %9.0g                 region, country code, cabinet code
------------------------------------------------------------------------------------------------------------------
Sorted by: 

. *     ****************************************************************  *;
. *       Drop African cabinets where there is no formateur coded.        *;
. *     ****************************************************************  *;
. drop if cabinetcode == 5;
(5 observations deleted)

. drop if cabinetcode == 23;
(3 observations deleted)

. *     ****************************************************************  *;
. *       Create variables for analysis in Table 3                        *;
. *     ****************************************************************  *;
. gen parliamentary = 0;

. replace parliamentary = 1 if presidential == 0;
(45 real changes made)

. label var parliamentary "1 = parliamentary, 0 = presidential";

. gen seatshare_parl= seatshare*parliamentary;

. gen formateur_parl= formateur*parliamentary;

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Produce results in Table 3                                      *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Model 1 all african cases                                       *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, robust;

Linear regression                               Number of obs     =         76
                                                F(5, 70)          =     494.06
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9693
                                                Root MSE          =     .05261

--------------------------------------------------------------------------------
               |               Robust
portfolioshare |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
     seatshare |   .7736803   .0745152    10.38   0.000     .6250644    .9222962
     formateur |   .2448744   .0494996     4.95   0.000     .1461505    .3435983
 parliamentary |   .0195763   .0170156     1.15   0.254    -.0143603    .0535129
seatshare_parl |    .130125   .0841461     1.55   0.127    -.0376991    .2979491
formateur_parl |  -.1876567   .0549714    -3.41   0.001    -.2972937   -.0780197
         _cons |  -.0065839   .0143996    -0.46   0.649    -.0353029    .0221351
--------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Model 2 presidential                                            *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur if parliamentary == 0 , robust;

Linear regression                               Number of obs     =         31
                                                F(2, 28)          =     472.88
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9676
                                                Root MSE          =     .06103

------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .7736803    .075247    10.28   0.000     .6195438    .9278167
   formateur |   .2448744   .0499857     4.90   0.000     .1424833    .3472655
       _cons |  -.0065839    .014541    -0.45   0.654    -.0363697    .0232019
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Model 3 parliamentary                                           *;
. *     ****************************************************************  *;
.  regress portfolioshare seatshare formateur if parliamentary == 1, robust;

Linear regression                               Number of obs     =         45
                                                F(2, 42)          =     758.45
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9711
                                                Root MSE          =     .04615

------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .9038053   .0388323    23.27   0.000     .8254386     .982172
   formateur |   .0572177   .0237512     2.41   0.020     .0092859    .1051495
       _cons |   .0129924   .0090057     1.44   0.157    -.0051819    .0311666
------------------------------------------------------------------------------

. *     ****************************************************************  *;
.  *       Replication of main text complete                               *;
. *     ****************************************************************  *;
.  *     ****************************************************************  *;
.  *       Robustness check with clustering - results robust although      *;
. *       the significance of the coefficient on formateur in Model 3     *;
. *       decreases and is only significant at the 0.08 level.            *;
. *     ****************************************************************  *;
.  regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, cluster(cabinetcode);

Linear regression                               Number of obs     =         76
                                                F(5, 25)          =     413.71
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9693
                                                Root MSE          =     .05261

                             (Std. Err. adjusted for 26 clusters in cabinetcode)
--------------------------------------------------------------------------------
               |               Robust
portfolioshare |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
     seatshare |   .7736803    .097488     7.94   0.000     .5728999    .9744606
     formateur |   .2448744   .0698387     3.51   0.002     .1010389    .3887099
 parliamentary |   .0195763   .0193781     1.01   0.322    -.0203336    .0594861
seatshare_parl |    .130125   .1069545     1.22   0.235     -.090152     .350402
formateur_parl |  -.1876567   .0759657    -2.47   0.021    -.3441109   -.0312025
         _cons |  -.0065839   .0165802    -0.40   0.695    -.0407315    .0275637
--------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 0, cluster(cabinetcode);

Linear regression                               Number of obs     =         31
                                                F(2, 10)          =     300.37
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9676
                                                Root MSE          =     .06103

                           (Std. Err. adjusted for 11 clusters in cabinetcode)
------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .7736803   .1002607     7.72   0.000     .5502854    .9970751
   formateur |   .2448744    .071825     3.41   0.007     .0848382    .4049105
       _cons |  -.0065839   .0170518    -0.39   0.708    -.0445777    .0314099
------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 1, cluster(cabinetcode);

Linear regression                               Number of obs     =         45
                                                F(2, 14)          =     515.63
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9711
                                                Root MSE          =     .04615

                           (Std. Err. adjusted for 15 clusters in cabinetcode)
------------------------------------------------------------------------------
             |               Robust
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .9038053   .0441536    20.47   0.000     .8091053    .9985053
   formateur |   .0572177   .0299981     1.91   0.077    -.0071218    .1215571
       _cons |   .0129924   .0100669     1.29   0.218     -.008599    .0345837
------------------------------------------------------------------------------

. *     ****************************************************************  *;
.  *       Repeat with bootstrap clustering - results robust.              *;
. *     ****************************************************************  *;
.  regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, vce(boot, cluster(cabin
> etcode) reps(400) seed(10101));
(running regress on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Linear regression                               Number of obs     =         76
                                                Replications      =        400
                                                Wald chi2(5)      =    1529.28
                                                Prob > chi2       =     0.0000
                                                R-squared         =     0.9693
                                                Adj R-squared     =     0.9672
                                                Root MSE          =     0.0526

                              (Replications based on 26 clusters in cabinetcode)
--------------------------------------------------------------------------------
               |   Observed   Bootstrap                         Normal-based
portfolioshare |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
     seatshare |   .7736803   .1242664     6.23   0.000     .5301225    1.017238
     formateur |   .2448744   .0857938     2.85   0.004     .0767216    .4130272
 parliamentary |   .0195763   .0225767     0.87   0.386    -.0246733    .0638258
seatshare_parl |    .130125   .1324631     0.98   0.326     -.129498     .389748
formateur_parl |  -.1876567   .0897988    -2.09   0.037    -.3636591   -.0116543
         _cons |  -.0065839   .0193902    -0.34   0.734     -.044588    .0314202
--------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 0, vce(boot, cluster(cabinetcode) reps(400) seed(
> 10101));
(running regress on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Linear regression                               Number of obs     =         31
                                                Replications      =        400
                                                Wald chi2(2)      =     671.20
                                                Prob > chi2       =     0.0000
                                                R-squared         =     0.9676
                                                Adj R-squared     =     0.9653
                                                Root MSE          =     0.0610

                            (Replications based on 11 clusters in cabinetcode)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
portfolios~e |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .7736803   .1079437     7.17   0.000     .5621144    .9852461
   formateur |   .2448744   .0764752     3.20   0.001     .0949858    .3947629
       _cons |  -.0065839   .0172516    -0.38   0.703    -.0403965    .0272287
------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 1, vce(boot, cluster(cabinetcode) reps(400) seed(
> 10101));
(running regress on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Linear regression                               Number of obs     =         45
                                                Replications      =        400
                                                Wald chi2(2)      =     990.58
                                                Prob > chi2       =     0.0000
                                                R-squared         =     0.9711
                                                Adj R-squared     =     0.9697
                                                Root MSE          =     0.0461

                            (Replications based on 15 clusters in cabinetcode)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
portfolios~e |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .9038053   .0446112    20.26   0.000     .8163689    .9912416
   formateur |   .0572177   .0285447     2.00   0.045     .0012711    .1131642
       _cons |   .0129924   .0104507     1.24   0.214    -.0074907    .0334754
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Jacknife procedures (drop one government)                       *;
. *     ****************************************************************  *;
. regress portfolioshare seatshare formateur parliamentary seatshare_parl formateur_parl, vce(jackknife, cluster(c
> abinetcode));
(running regress on estimation sample)

Jackknife replications (26)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..........................

Linear regression                               Number of obs     =         76
                                                Replications      =         26
                                                F(   5,     25)   =     367.85
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9693
                                                Adj R-squared     =     0.9672
                                                Root MSE          =     0.0526

                              (Replications based on 26 clusters in cabinetcode)
--------------------------------------------------------------------------------
               |              Jackknife
portfolioshare |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
     seatshare |   .7736803   .1266664     6.11   0.000      .512806    1.034555
     formateur |   .2448744   .0865433     2.83   0.009      .066635    .4231137
 parliamentary |   .0195763   .0226204     0.87   0.395    -.0270113    .0661638
seatshare_parl |    .130125   .1347874     0.97   0.344    -.1474749    .4077249
formateur_parl |  -.1876567   .0919532    -2.04   0.052    -.3770379    .0017245
         _cons |  -.0065839   .0202282    -0.33   0.748    -.0482446    .0350768
--------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 0, vce(jackknife, cluster(cabinetcode));
(running regress on estimation sample)

Jackknife replications (11)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
...........

Linear regression                               Number of obs     =         31
                                                Replications      =         11
                                                F(   2,     10)   =     273.94
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9676
                                                Adj R-squared     =     0.9653
                                                Root MSE          =     0.0610

                            (Replications based on 11 clusters in cabinetcode)
------------------------------------------------------------------------------
             |              Jackknife
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .7736803   .1230832     6.29   0.000     .4994339    1.047927
   formateur |   .2448744   .0840762     2.91   0.015     .0575409    .4322078
       _cons |  -.0065839    .019666    -0.33   0.745    -.0504025    .0372347
------------------------------------------------------------------------------

. regress portfolioshare seatshare formateur if parliamentary == 1, vce(jackknife, cluster(cabinetcode));
(running regress on estimation sample)

Jackknife replications (15)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
...............

Linear regression                               Number of obs     =         45
                                                Replications      =         15
                                                F(   2,     14)   =     510.41
                                                Prob > F          =     0.0000
                                                R-squared         =     0.9711
                                                Adj R-squared     =     0.9697
                                                Root MSE          =     0.0461

                            (Replications based on 15 clusters in cabinetcode)
------------------------------------------------------------------------------
             |              Jackknife
portfolios~e |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   seatshare |   .9038053   .0454566    19.88   0.000     .8063105      1.0013
   formateur |   .0572177   .0306473     1.87   0.083    -.0085142    .1229496
       _cons |   .0129924   .0099779     1.30   0.214    -.0084082    .0343929
------------------------------------------------------------------------------

. log close;
      name:  <unnamed>
       log:  C:\Users\sgolder\Dropbox\Portfolio Allocation\replication\africancabinets_africa.log
  log type:  text
 closed on:  30 Mar 2017, 12:51:59
------------------------------------------------------------------------------------------------------------------
